package com.notifier;

import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;

public class BreweryGUI implements ActionListener{

	private static final long serialVersionUID = 1L;
	
	JButton startButton;
	JButton endButton;
	boolean go = false;

	public BreweryGUI(){

		JFrame.setDefaultLookAndFeelDecorated(true);
		JFrame frame = new JFrame("FrameDemo");
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		frame.pack();
		frame.setSize(500, 500);
		frame.setVisible(true);
		

        startButton = new JButton("Start Brewery Search");
        startButton.setActionCommand("start");
        startButton.addActionListener(this);
        startButton.setSize(50,20);
        startButton.setLocation(50,50);
        frame.getContentPane().add(startButton);

        
        endButton = new JButton("Stop Brewery Search");
        endButton.setActionCommand("stop");
        endButton.addActionListener(this);
        endButton.setSize(50, 20);
        endButton.setLocation(100,100);
        frame.getContentPane().add(endButton);
        
	}

	@Override
	public void actionPerformed(ActionEvent a) {
		if(a.getSource().equals(startButton)){
			try {
				StaticExecutor.main(null);
			} catch (Exception e) {
				e.printStackTrace();
			}
		}
		else{
			System.exit(0);
		}
	}

	public static void main(String[] args){
		BreweryGUI test = new BreweryGUI();
	}
	
	
}
